import React from 'react';
import { connect } from 'dva';
import { Form } from 'antd';
import Perform from './Perform';
import moment from 'moment';

export default connect(({ cost, order }: any) => ({
  view: cost.view,
  personData: order.personData,
}))(
  Form.create({
    mapPropsToFields(props: any) {
      return {
        staffId: Form.createFormField({
          value: props.view.staffId,
        }),
        typeCode: Form.createFormField({
          value: props.view.typeCode,
        }),
        cost: Form.createFormField({
          value: props.view.cost,
        }),
        costTime: Form.createFormField({
          value: moment(props.view.costTime),
        }),
        comments: Form.createFormField({
          value: props.view.comments,
        }),
      };
    },
  })(Perform),
);
